#pragma once

#include <iostream>


#define Die(code)   \
    do              \
    {               \
        exit(code); \
    } while (0)

#define CONV(v) (struct sockaddr *)(v)

enum 
{
    USAGE_ERR = 1,
    SOCKET_ERR,
    BIND_ERR
};
bool SplitString(std::string &line ,std::string * key,std::string* value, const std::string& symbol)
{
    size_t pos = line.find(symbol);
    if(pos == std::string::npos)
    {
        return false;
    }
    *key = line.substr(0,pos);
    *value = line.substr(pos+symbol.size());

    if(key->empty() || value->empty())
    {
        key->clear();
        value->clear();
        return false;
    }

    return true;

}